/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package CastleDefense;

/**
 *
 * @author Administrator
 */
import java.util.ArrayList;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;

//This statement means that class "WaveList.java" is the root-element of our example
@XmlRootElement(namespace = "WaveList")
public class WaveList
{
    // XmLElementWrapper generates a wrapper element around XML representation
    @XmlElementWrapper(name = "WaveList")
    // XmlElement sets the name of the entities
    @XmlElement(name = "wave")
    private ArrayList<Wave> WaveList;
    private ArrayList<Wave> tmpList = new ArrayList<Wave>();

    public void setWaveList(ArrayList<Wave> WaveList)
    {
        this.WaveList = WaveList;
    }

    public ArrayList<Wave> getWavesList()
    {
        return WaveList;
    }

    public void appendWaveList(ArrayList<Wave> WaveList)
    {
        for(int i=0; i<WaveList.size(); i++)
        {
            tmpList.add(WaveList.get(i));
        }
        this.WaveList = tmpList;
    }

    public Wave getWaveByID(int id)
    {
        for (Wave myWave : WaveList)
        {
            if(myWave.getId()==id)
                return myWave;
        }
        return null;
    }

    public Integer size()
    {
        return WaveList.size();
    }
}
